home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / programm / prog_a2m / freeused / freeused.bas < prev   
BASIC Source File  |  1995-05-02  |  1KB  |  21 lines

  1. 'This Sub program requires a drive letter to be passed to the 
  2. 'sub in DRIVE$ the letter can be Upper or lower case.
  3. 'the free bytes of the drive will be returned in Free&
  4. 'the used bytes will be returned in Used&.
  5. 'This routine is PowerNet compatible.
  6. 'Writen by Chris Roberts @ DragonWare Software Inc.
  7. 'This code is in the public domain.
  8.  
  9. SUB DiskFreeUsed(free&,used&,DRIVE$)
  10. SHARED free&,used&   
  11. LOCAL buffer&(4),drive,Fclusters&,Tclusters&,BSECTOR&,SPCLUSTER&,tmp&
  12. LET drive=ASC(UCASE$(drive$))-64      'get drive number
  13. CALL dfree(buffer&(),drive)           'Read drive's FAT
  14. LET fclusters&=buffer&(0)             'get free clusters
  15. LET tclusters&=buffer&(1)             'get total clusters of drive
  16. LET bsector&=buffer&(2)               'get sector size
  17. LET spcluster&=buffer&(3)             'get cluster size
  18. LET tmp&=bsector&*spcluster&          'get bytes per cluster
  19. LET free&=fclusters&*tmp&             'find the free bytes
  20. LET used&=tclusters&-fclusters&*tmp&  'find the used bytes on drive
  21. END SUB